/**
 * 
 */
package qualification2010;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * @author Coddy created on 2010-5-7
 * 
 */
public class StoreCredit
{
	static String input = "A-large-practice.in";
	static String output = "A-large-practice.out";

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		try
		{
			BufferedReader bf = new BufferedReader(new FileReader(input));
			BufferedWriter bw = new BufferedWriter(new FileWriter(output));
			int n = Integer.parseInt(bf.readLine());

			for (int i = 1; i <= n; i++)
			{
				int c = Integer.parseInt(bf.readLine());
				int itemCount = Integer.parseInt(bf.readLine());
				int[] prices = new int[itemCount];

				String line = bf.readLine();

				StringTokenizer tokenizer = new StringTokenizer(line);
				int k = 0;
				while (tokenizer.hasMoreElements())
				{
					String string = (String) tokenizer.nextElement();
					prices[k] = Integer.parseInt(string);
					k++;
				}

				boolean found = false;
				for (int j = 0; j < prices.length; j++)
				{
					for (int j2 = j + 1; j2 < prices.length; j2++)
					{
						if (prices[j] + prices[j2] == c)
						{
							found = true;
							bw.write("Case #" + i + ": " + (j + 1) + " "
									+ (j2 + 1));
							bw.write("\n");
							break;
						}
					}
					if (found)
					{
						break;
					}
				}
				bw.flush();
			}
			// for (int i = 1; i <= n; i++)
			// {
			// int k = Integer.parseInt(bf.readLine());
			//
			// Set set = new TreeSet();
			// String line = bf.readLine();
			//
			// StringTokenizer tokenizer = new StringTokenizer(line);
			// while (tokenizer.hasMoreElements())
			// {
			// String string = (String) tokenizer.nextElement();
			// int number = Integer.parseInt(string);
			// if (set.contains(number))
			// {
			// set.remove(number);
			// } else
			// {
			// set.add(number);
			// }
			// }
			//
			// bw.write("Case #" + i + ": " + set.toArray()[0]);
			// bw.write("\n");
			//
			// }
			// bw.flush();

		} catch (FileNotFoundException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NumberFormatException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
